<div class="edit">
<?php 
if(($user->getId() == $ad->getUserId()) || ($user->getLevel() > 4))
{
	unset($buttons);
	$statusTxt = '';
	$nextWeek = time() + (7 * 24 * 60 * 60)*2;
	
	$buttons[0]['title'] = ucfirst($txt->getWord('edit').' '.$txt->getWord('this_ad'));
	$buttons[0]['href'] = '/c/11/?edit=ad&ad='.$ad->getId();
	$buttons[0]['params']['class'] = 'btn btn-default bold';
	$buttons[0]['params']['icon'] = 'icon-edit';
	
	if($ad->getIsCompleted() > 0)
	{
		if(($ad->getIsPaid() > 0) && ($ad->getIsValid()))
		{ 
			$buttons[1]['title'] = ucfirst($txt->getWord('publish').' '.$txt->getWord('again'));
			$buttons[1]['href'] = '/c/11/?list=ad&activate='.$ad->getId().'';
			$buttons[1]['onclick'] = '';
			$buttons[1]['params']['class'] = 'btn btn-default bold';
			$buttons[1]['params']['icon'] = 'icon-play';
			$statusTxt = ucfirst($ad->getIsBoughtText());
			
			if($ad->getArchived() == 0)
			{
				$buttons[2]['title'] = ucfirst($txt->getWord('archive'));
				$buttons[2]['href'] = '/c/11/?list=ad&archive='.$ad->getId().'';
				$buttons[2]['onclick'] = '';
				$buttons[2]['params']['icon'] = 'icon-archive';
				$buttons[2]['params']['class'] = 'btn btn-default bold';
			}
		}
	}
	else
	{
		if($ad->getActive() > 0)
		{ 
			$buttons[1]['title'] = ucfirst($txt->getWord('set_as').' '.$ad->getIsBoughtText());
			$buttons[1]['href'] = '/c/11/?list=ad&complete='.$ad->getId().'';
			$buttons[1]['onclick'] = '';
			$buttons[1]['params']['class'] = 'btn btn-default bold';
			$buttons[1]['params']['icon'] = 'icon-play';
			$statusTxt = ucfirst($txt->getWord('published'));
			
			if($ad->getArchived() == 0)
			{ 
				$buttons[2]['title'] = ucfirst($txt->getWord('archive'));
				$buttons[2]['href'] = '/c/11/?list=ad&archive='.$ad->getId().'';
				$buttons[2]['onclick'] = '';
				$buttons[2]['params']['class'] = 'btn btn-default bold';
				$buttons[2]['params']['icon'] = 'icon-archive';
				$statusTxt = ucfirst($txt->getWord('published'));
				
				if((strtotime($ad->getDateActiveEnd()) < $nextWeek) /*|| ($user->getPartnerStatus() > 2)*/)
				{ 
					$buttons[4]['title'] = ucfirst($txt->getWord('renew'));
					$buttons[4]['href'] = '/c/11/?edit=ad&ad='.$ad->getId().'&amp;display=renew';
					$buttons[4]['onclick'] = '';
					$buttons[4]['params']['class'] = 'btn btn-default bold';
					$buttons[4]['params']['icon'] = 'icon-forward';
					if(strtotime($ad->getDateActiveEnd()) < time())
					{ $statusTxt = ucfirst($txt->getWord('expired')); }
				}
			}
			else
			{
				//SYSICONS_URL.'unarchive_16.png
				$buttons[2]['title'] = ucfirst($txt->getWord('restore'));
				$buttons[2]['href'] = '/c/11/?list=ad&unarchive='.$ad->getId().'';
				$buttons[2]['onclick'] = '';
				$buttons[2]['params']['class'] = 'btn btn-default bold';
				$buttons[2]['params']['icon'] = 'icon-repeat';
				$statusTxt = ucfirst($txt->getWord('archived'));
			}
		}
		else
		{ 
			if($ad->getIsPaid() > 0)
			{
				if($ad->getIsValid())
				{
					$buttons[1]['title'] = ucfirst($txt->getWord('publish'));
					$buttons[1]['href'] = '/c/11/?list=ad&activate='.$ad->getId().'';
					$buttons[1]['onclick'] = '';
					$buttons[1]['params']['class'] = 'btn btn-default bold btn-success';
					$buttons[1]['params']['icon'] = 'icon-play';
					$statusTxt = ucfirst($txt->getWord('paid'));
				}
			}
			else
			{ 
				if($ad->getIsValid())
				{
					$buttons[1]['title'] = ucfirst($txt->getWord('proceed_to_payement')).' >>';
					$buttons[1]['href'] = '/c/11/?edit=payment&ad='.$ad->getId().'';
					$buttons[1]['onclick'] = '';
					$buttons[1]['params']['class'] = 'btn btn-default bold btn-success bold';
					$buttons[1]['params']['icon'] = 'icon-credit-card';
					$statusTxt = ucfirst($txt->getWord('not').' '.$txt->getWord('paid'));
				}
			}
		}
	}
	if(($user->getLevel() > 4) || ($ad->getIsDeletable() > 0))
	{
		$buttons[3]['title'] = ucfirst($txt->getWord('delete'));
		$buttons[3]['href'] = ''; // /c/11/?list=ad&delete='.$ad->getId().'';
		$buttons[3]['onclick'] = '';
		$buttons[3]['params']['class'] = 'btn btn-danger bold deleteAdButton';
		$buttons[3]['params']['rel'] = $ad->getId();
		$buttons[3]['params']['id'] = 'del_ad_'.$ad->getId();
		$buttons[3]['params']['icon'] = 'icon-trash';
		
	}
	echo '<div class="edit-sidebar">';
	echo getButtonsHTML($theme->HFBSets[$theme->ComHFB]['button'], $buttons);
	unset($buttons);
	?></div><div class="clear"></div><br />
	<p class="section-title small-txt">
	<?php echo ucfirst($txt->getWord('current').' '.$txt->getWord('status')).': <b>'.$statusTxt.'</b>&nbsp;&nbsp;|&nbsp;&nbsp;'; ?>
	<?php echo ucfirst($txt->getWord('detail_views')).': <b>('.$ad->getViewsDetail().')</b> '.'&nbsp;&nbsp;|&nbsp;&nbsp;'; ?>
	<?php echo ucfirst($txt->getWord('list_views')).': <b>('.$ad->getViewsList().')</b> '.'&nbsp;&nbsp;|&nbsp;&nbsp;'; ?>
	<?php if($ad->getDateModified() != '0000-00-00 00:00:00'):?>
	<?php echo ucfirst($txt->getWord('last_modified')).': <b>'.$ad->getDateModified('d.m.y').'</b>'; ?>
	<?php endif; ?>
	</p>
	<?php
}
?>
</div>